// ****************************************************************************
// *     Filename:  HistoManager.hh
// *  Description:  
// *      License:  Geant4 Software License 
// *                http://geant4.cern.ch/license/LICENSE.html
// *       Author:  Tran Hoai Nam (nam), nam@kuno-g.phys.sci.osaka-u.ac.jp
// * Organization:  Osaka University
// *      Created:  2012-09-18 11:29:14
// ****************************************************************************
#ifndef HISTOMANAGER_K0ZKMJII
#define HISTOMANAGER_K0ZKMJII

#include "globals.hh"
#include "G4ThreeVector.hh"
#include "TH1D.h"
#include "TFile.h"
#include "TTree.h"
#include "../rootlibs/TEvent.h"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

 class TFile;
 class TTree;
 class TH1D;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

class HistoManager
{
  public:
    HistoManager(G4String filename); //create filename
   ~HistoManager();
   
    void book(); //Create tree and structure
    void save(); //Write tree to file
		void AutoSave();
    void FillTree();
    void PrintStatistic();
		inline G4String SetRootName() const {return fRootName;} 
		void WriteEvt(TEvent *evt){fpEvt = evt;} //interface for EventAction to write event to tree
        
  private:
		TEvent	 *fpEvt;
		G4String fRootName;
    TFile*   fpRootFile;
    TTree*   fpTree;    
};

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#endif /* end of include guard: HISTOMANAGER_K0ZKMJII */
